from typing import Optional, Tuple

from django.db.models import QuerySet

from server.apps.main.logic.todo import  validation, commands

def run(
    id: int,
    title: Optional[str],
    description: Optional[str],
    is_done: Optional[bool]
) -> None:
    """Validates data, maybe creates a new post, returns all published ones."""
    validated_data = validation.validate_edit(id,
        title=title,
        description=description,
        is_done=is_done
    )
    if validated_data:
        commands.edit(id,validated_data)
    
    